package com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.fragment.my.bean.GetCommentListsBean

class MyCommentsViewModel:BaseViewModel() {
    private val loginRepository by lazy { RetrofitClient.getApiService() }
    val getUserCenterState = MutableLiveData<GetCommentListsBean>()
    /**
     * 获取评论
     */
    fun getUserCenter(){
        launch(
                block = {
                    val codeStatus = loginRepository.getCommentLists()
                    getUserCenterState.value=codeStatus.result()
                },
                error = {
                    messageStatus.value="返回异常:"+it.message
                },
                cancel = {
                    messageStatus.value="返回异常:"+it.message
                },
                showErrorToast = false
        )
    }

}